"use strict";
/* Controllers */
app.controller("dqcConfigAddController", ['$scope', '$location', '$rootScope', '$q','$routeParams', 'dqcConfigAddService', function ($scope, $location, $rootScope, $q, $routeParams, dqcConfigAddService) {

    var vm = $scope.vm = {};
    vm.p = {};

    //e_time\s*[\)]?\s*[>|>=|<|<=|=]{1,2}\s*['|"]{1}%s['|"]{1}
    var errorFn = function (result) {
        alert(result);
    };

//    $scope.validateSql=function(){
//        console.log("sql"+vm.p.sql)
//    }

    $scope.dqcConfigAdd = function () {
        var vm = $scope.vm;
        var params = vm.p;
        var procFn = function (response) {
            if (response.success && response.data) {
                alert("添加成功！")
            } else {
                alert(response.msg);
            }
        };
        dqcConfigAddService.dqcConfigAdd(params, procFn, errorFn);
    };


}]);


/* Services */
app.service('dqcConfigAddService', ['ajaxService', function (ajaxService) {

    this.dqcConfigAdd = function (params, successFunction, errorFunction) {
        ajaxService.AjaxPost(params, "/star/api/basic-service/v1/dqc/addDqcConfig.do", successFunction, errorFunction);
    };

}]);

